<!DOCTYPE html>
<html>

<head>
    <title>侧边栏</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="format-detection" content="telephone=no" />
    <style>
        html,
        body,
        header,
        section,
        footer,
        nav,
        div,
        ul,
        ol,
        li,
        img,
        a,
        span,
        em,
        del,
        center,
        strong,
        var,
        fieldset,
        form,
        label,
        dt,
        dd,
        cite,
        input,
        hr,
        time,
        mark,
        code,
        figcaption,
        figure,
        textarea {
            margin: 0;
            border: 0;
            padding: 0;
            font-family: "宋体";
            font-style: normal;
        }

        html,
        body {
            -webkit-touch-callout: none;
            -webkit-text-size-adjust: none;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            -webkit-user-select: none;
        }

        header,
        footer,
        section,
        nav,
        img,
        a,
        button,
        em,
        del,
        strong,
        var,
        fieldset,
        label,
        cite,
        small,
        time,
        mark,
        code,
        figcaption,
        figure,
        textarea {
            display: block;
        }

        header,
        section,
        footer,
        nav {
            position: relative;
            overflow: hidden;
        }

        ol,
        ul {
            list-style: none;
        }

        input,
        button,
        textarea {
            border: 0;
            margin: 0;
            padding: 0;
            font-size: 1em;
            line-height: 1em;
            -webkit-appearance: none;
            background-color: rgba(0, 0, 0, 0);
        }

        span {
            display: inline-block;
        }

        a,
        a:visited {
            text-decoration: none;
        }

        body {
            background-color: #404040;
        }

        #main {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: -webkit-box;
            -webkit-box-orient: vertical;
        }

        header {
            height: 80px;
            background-color: #333333;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            padding-top: 20px;
        }

        header>div {
            display: -webkit-box;
            -webkit-box-pack: left;
            width: 100%;
            margin-left: 5%;
            -webkit-box-align: start;
        }

        #logo {
            -webkit-box-flex: 1;
            -webkit-box-align: center;
        }

        #logo>img {
            width: 60px;
            vertical-align: middle;
        }

        #logo>span {
            font-size: 18px;
            font-weight: bold;
            padding: 15px 0px 10px 10px;
            color: #fff;
        }

        #username {
            position: absolute;
            color: #fff;
            line-height: 16px;
            font-size: 16px;
            top: 50%;
            left: 80px;
            vertical-align: middle;
            margin-top: -8px;
        }

        section {
            -webkit-box-flex: 1;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            background-color: #404040;
        }

        a {
            position: relative;
            -webkit-box-flex: 1;
        }

        .ui {
            color: #fff;
            border-bottom: 1px solid #333333;
            box-shadow: 0 1px 0 #6e6e6e;
            width: 100%;
            display: -webkit-box;
            -webkit-box-orient: horizontal;
            overflow: hidden;
        }

        .navmenu {
            color: #fff;
            border-bottom: 1px solid #333333;
            box-shadow: 0 1px 0 #6e6e6e;
            width: 100%;
            display: -webkit-box;
            -webkit-box-orient: horizontal;
            overflow: hidden;
        }

        .function {
            color: #fff;
            border-bottom: 1px solid #333333;
            box-shadow: 0 1px 0 #6e6e6e;
            width: 100%;
            display: -webkit-box;
            -webkit-box-orient: horizontal;
            overflow: hidden;
        }

        a>.img {
            position: absolute;
            width: 30px;
            height: 30px;
            margin-left: 30px;
            line-height: 16px;
            font-size: 16px;
            top: 50%;
            margin-top: -15px;
        }

        a>.info {
            position: absolute;
            margin-left: 10px;
            line-height: 16px;
            font-size: 16px;
            top: 50%;
            left: 80px;
            vertical-align: middle;
            margin-top: -8px;
        }

        a>em {
            position: absolute;
            top: 23px;
            right: 47px;
            width: 18px;
            height: 18px;
            background-color: #333333;
            -webkit-border-radius: 3px;
            color: #3c7390;
            font-size: 10px;
            line-height: 18px;
            text-align: center;
        }

        .copy_v {
            width: 90%;
            margin-right: auto;
            margin-left: auto;
        }

        .copy_v>img {
            width: 25%;
            margin: 0px 20%;
        }

        .copy_v>span {
            width: 50%;
            margin: 5%;
            color: #b8b8b8;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="main">
        <header id="header">
            <div id="logo">
                <span><img src="../image/btn/leftMenu_user.png" /></span>
                <span id="username"></span>
            </div>
        </header>
        <section>
            <!-- <a class="ui" tapmode="ui-hov" onClick="goto_openWinFun(3)"><span class="img"><img src="../image/btn/leftMenu_btn4.png" width="100%"></span><span class="info">每日要情</span></a> -->
            <a class="ui" tapmode="ui-hov" onClick="goto_openWinFun(1)"><span class="img"><img src="../image/btn/leftMenu_btn1.png" width="100%"></span><span class="info">我的收藏</span></a>
            <a id="allyqlist" class="ui" tapmode="ui-hov" onClick="goto_openWinFun(6)"><span class="img"><img src="../image/btn/leftMenu_btn6.png" width="100%"></span><span class="info">舆情总览</span></a>
            <a class="navmenu" tapmode="navmenu-hov" onClick="goto_openWinFun(2)"><span class="img"><img src="../image/btn/leftMenu_btn2.png" width="100%"></span><span class="info">修改密码</span></a>
            <a class="function" tapmode="function-hov" onClick="goto_loginOut()"><span class="img"><img src="../image/btn/leftMenu_btn3.png" width="100%"></span><span class="info">退出登录</span></a>
            <!--<a class="function" tapmode="function-hov" onClick="goto_testingPhotoFun()">
            	<span class="img"><img src="../image/btn/leftMenu_btn3.png" width="100%"></span>
            	<span class="info">测试拍照</span></a>-->
            <a><span>&nbsp;</span></a>
            <a class="copy_v">
                <img src="../res/logo.png" width="100%" />
                <span><!--舆情处置平台V2.0.0--></span>
            </a>
        </section>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/alpenlicebe.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hashes.min.js"></script>
<script>
    function goto_testingPhotoFun() {
        var delay = 0;
        if ("ios" != api.systemType) {
            delay = 300;
        }
        api.openWin({
            name: 'app_About',
            url: "./app_About.html",
            bounces: false,
            reload: true,
            delay: delay
        });
    }
    window.apiready = function() {
        api.setStatusBarStyle({
            style: 'light',
            color: 'transparent'
        });
        // 输出系统版本号
        var appVersion = api.appVersion;
        $(".copy_v span").html("舆情处置平台V" + appVersion);
        goto_getUserInfoFun();
        /*注册监听事件-用户登录*/
        api.addEventListener({
            name: 'Alpe_Event_UserLogin'
        }, function(ret) {
            if (ret) {
                api.setStatusBarStyle({
                    style: 'light',
                    color: 'transparent'
                });
                goto_getUserInfoFun();
            }
        });
    }

    function goto_getUserInfoFun() {
        var username = Alpe_getLocalStorge("username");
        var password = Alpe_getLocalStorge("password");
        if ('' != username) {
            document.getElementById("username").innerHTML = username;
        } else {
            document.getElementById("username").innerHTML = '<span tapmode="function-hov" onClick="goto_loginOut()">重新登录</span>';
        }

        // $("#allyqlist").hide();
        //
        // var MD5 = new Hashes.MD5;
        // var access_token = Alpe_getLocalStorge("access_token");
        // var admin_id = Alpe_getLocalStorge("admin_id");
        // var sign = MD5.hex(access_token + admin_id + 'user/getUser1.0syjqingbao');
        // var url = Alpe_ApiUrl + 'r=user/getUser&access_token=' + access_token + '&admin_id=' + admin_id +
        //     '&v=1.0&sign=' + sign;
        //     // console.log(url);
        // api.ajax({
        //     url: url,
        //     method: 'get',
        //     cache: false,
        //     timeout: 30,
        //     dataType: 'json'
        // }, function(ret, err) {
        //     api.hideProgress();
        //     if ("100" == ret.success) {
        //         api.hideProgress();
        //         if (ret.admin_id_level == 1) {
        //             $("#allyqlist").show();
        //         }
        //     }
        // });
    }

    function goto_loginOut() {
        api.confirm({
            title: '退出登录',
            msg: '确定要退出舆情处置平台！',
            buttons: ['确定', '取消']
        }, function(ret, err) {
            if (ret.buttonIndex == 1) {
                var MD5 = new Hashes.MD5;
                var access_token = Alpe_getLocalStorge("access_token");
                var admin_id = Alpe_getLocalStorge("admin_id");
                var sign = MD5.hex(access_token + admin_id + 'login/logout1.0syjqingbao');

                var url = Alpe_ApiUrl + 'r=login/logout&access_token=' + access_token + '&admin_id=' + admin_id +
                    '&v=1.0&sign=' + sign;
                api.ajax({
                    url: url,
                    method: 'get',
                    cache: false,
                    timeout: 30,
                    dataType: 'json'
                }, function(ret, err) {
                    if ("010" == ret.success) {
                        api.hideProgress();
                        Alpe_setLocalStorge('sys_userID', '');
                        Alpe_setLocalStorge('access_token', '');
                        Alpe_setLocalStorge('admin_id', '');
                        //Alpe_setLocalStorge('username','');
                        //Alpe_setLocalStorge('password','');
                        var delay = 0;
                        if ("ios" != api.systemType) {
                            delay = 300;
                        }
                        api.openWin({
                            name: 'login',
                            url: 'login.html',
                            bounces: false,
                            reload: true,
                            rect: {
                                x: 0,
                                y: 0,
                                w: 'auto',
                                h: 'auto'
                            },
                            delay: delay
                        });
                    } else {
                        api.toast({
                            msg: ret.message,
                            duration: 3000,
                            location: 'middle'
                        });
                        var delay = 0;
                        if ("ios" != api.systemType) {
                            delay = 300;
                        }
                        api.openWin({
                            name: 'login',
                            url: 'login.html',
                            bounces: true,
                            reload: true,
                            rect: {
                                x: 0,
                                y: 0,
                                w: 'auto',
                                h: 'auto'
                            },
                            delay: delay
                        });
                        api.hideProgress();
                    }
                });
            }
        });
    }

    function goto_openWinFun(winIndex) {
        var winName = "userPWD";
        if (1 == winIndex) {
            winName = "userFavorites";
        } else if (3 == winIndex) {
            winName = "list_mryq_top";
        }else if (6 == winIndex) {
            winName = "yq_listAll";
        } else {
            winName = "userPWD";
        }
        var delay = 0;
        if ("ios" != api.systemType) {
            delay = 300;
        }
        api.openWin({
            name: winName,
            url: "./" + winName + ".html",
            pageParam: {
                winName: winName
            },
            bounces: false,
            vScrollBarEnabled: false,
            hScrollBarEnabled: false,
            reload: true,
            delay: delay
        });
    }
</script>

</html>
